import request from '/@/utils/request';


export function useUserApi() {
	return {
		// 获取子用户
		getUser: () => {
			return request({
				url: 'user/subset',
				method: 'get'
			});
		},
		// 分页获取用户
		getUsers: (params?: object) => {
			return request({
				url: 'user/withrole',
				method: 'get',
				params
			});
		},
		// 分页获取用户
		getUserNoRole: (params?: object) => {
			return request({
				url: 'user/',
				method: 'get',
				params
			});
		},
		// 新增用户
		addUser: (data: object) => {
			return request({
				url: 'user/',
				method: 'post',
				data
			});
		},
		// 修改用户
		updateUser: (data: object) => {
			return request({
				url: 'user/',
				method: 'put',
				data
			});
		},
		// 删除用户
		deleteUser:(data:object)=>{
			return request({
				url:'user/',
				method:'delete',
				data
			})
		},
		// 校验账户的唯一性
		checkAccount: (params:object) => {
			return request({
				url: 'check/account',
				method: 'get',
				params
			})
		}
	};
}
